<?php include("config.php");
if($submit) {
	session_start();
	if(!isset($_SESSION["SecurityCode"])) { // If no security code on server generated (illegal access)
		die ("<p><b>Illegal form access!</b></p>\n");
	}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title><?php echo $sitename; ?> - Contact Us</title>
<meta name="description" content="<?php echo $sitename; ?> - Contact Us">
<meta name="keywords" content="free to try, software, shareware, freeware, developers, vendors, download, PAD">
<meta name="robots" content="all">
<meta name="author" content="Andrey Aleksanyants, M.D.">
<meta name="copyright" content="<?php echo $sitename; ?>">
<meta http-equiv="imagetoolbar" content="no">
<meta http-equiv="Page-Enter" content="BlendTrans(Duration=4)">
<meta http-equiv="Page-Exit" CONTENT="BlendTrans(Duration=4)">
<link rel="stylesheet" type="text/css" href="<?php echo $cssfile; ?>">
<link rel="shortcut icon" href="favicon.ico">
<link rel="alternate" type="application/rss+xml" title="New Releases and Updates" href="rss.php"/>
<link rel="alternate" type="application/rss+xml" title="Most Popular Software" href="rss.php?feed=popular"/>
<link rel="alternate" type="application/rss+xml" title="Top Rated Software" href="rss.php?feed=rating"/>
<script language="javascript">
<!--
function formcheck() {
	if(document.contact.name.value=="") {
		alert("You did not enter your name!");
		document.contact.name.focus();
		return false;
	}
	if(document.contact.email.value=="") {
		alert("You did not enter your email address!");
		document.contact.email.focus();
		return false;
	}
	if(document.contact.email.value.match(/^([a-zA-Z0-9_/.~\-]+)@([a-zA-Z0-9_/.~\-]+)\.([a-z]+)$/)==null) {
		alert("The email address is not valid!");
		document.contact.email.focus();
		return false;
	}
	if(document.contact.subject.selectedIndex==0) {
		alert("You did not select the message subject!");
		document.contact.subject.focus();
		return false;
	}
	if(document.contact.mtext.value.length<10) {
		alert("Please enter at least 10 characters in message text field!");
		document.contact.mtext.focus();
		return false;
	}
	if(document.contact.mtext.value.length>2000) {
		alert("Please enter at most 2000 characters in message text field!");
		document.contact.mtext.focus();
		return false;
	}
	if(document.contact.securitycode.value=="") {
		alert("You did not enter the security code!");
		document.contact.securitycode.focus();
		return false;
	}
	return true;
}

function collapseAll() {
	var LItems=document.getElementById("catlist").getElementsByTagName("li");
	for(o=0; o<LItems.length; o++) {
		if(LItems[o].className=="open") {
			LItems[o].className="close";
		}
		if(LItems[o].getElementsByTagName("ul").length>0) {
			curChilds=LItems[o].getElementsByTagName("span");
			if(curChilds.length>0) {
				curChilds[0].onclick=function() {
					ShowHide(this.parentNode);
				}
				if(curChilds[0].className=="open") {
					curChilds[0].className="close";
				}
			}
			curChilds=LItems[o].getElementsByTagName("a");
			if(curChilds.length>0) {
				curChilds[0].onclick=function() {
					ShowHide(this.parentNode);
					return false;
				}
			}
		}
	}
}

function ShowHide(curHeader) {
	if(curHeader.className=="close") {
		curHeader.className="open";
	}
	else if(curHeader.className=="open") {
		curHeader.className="close";
	}
}
// -->
</script>
</head>
<body onLoad="collapseAll();">
<?php include("header.inc"); ?>
<table bgcolor="White" width="980" align="center">
<tr><td width="180" valign="top">
<table width=180 border=0 cellpadding=0 cellspacing=0 background="images/middle.gif">
          <tbody>
            <tr>
              <td height="2" class="table-top"></td>
            </tr>
            <tr>
              <td align=left valign=top class="left">
<?php
$which_class = "Audio & Multimedia";
include_once('categories1.inc');
?>
</td>
            </tr>
            <tr>
              <td height="8" class="table-bottom"></td>
            </tr>
          </tbody>
        </table>
      <br>
        <table width=180 
            border=0 align="center" cellpadding=0 cellspacing=0 
            background="images/middle.gif">
          <tbody>
            <tr>
              <td width="8" height="2" class="table-top"></td>
              <td width="172" class="table-top"></td>
            </tr>
            <tr>
              <td align=left valign=center class="left-rss">:<br>
                  <br>
                  <p></p>
                <p></p></td>
              <td align=left valign=center class="left-rss"><span class="left-b"><img src="images/rss.gif" width="36" height="14">RSS Feeds</span><br>
                <img src="images/rss-1.gif" alt="new" width="14" height="14"><a href="rss.php">New Releases and Updates</a><br>
                  <img src="images/rss-1.gif" alt="new" width="14" height="14"><a href="rss.php?feed=popular">Most Popular Software</a><br>
                  <img src="images/rss-1.gif" alt="new" width="14" height="14"><a href="rss.php?feed=rating">Top Rated Software</a></td>
            </tr>
            <tr>
              <td height="8" colspan="2" class="table-bottom"></td>
            </tr>
          </tbody>
        </table>
&nbsp;</td>
<td valign="top">
<h1>Contact <?php echo $sitename; ?></h1>
<p>Use this contact form if you have any questions or suggestions related to <?php echo $sitename; ?> web site.</p>
<p>Note: <?php echo $sitename; ?> is a software distribution network, we are not able to offer technical support for listed products. Please contact the authors directly if you are looking for customer service for listed products.</p>
<p>If you are a Software Developer, please use the submission form <a href="submit.php">here</a>.</p>
<br>
<?php

// Requesting URL data
$progid       = $_GET["progid"];
$subj         = $_GET["subj"];

if ($subj == "broken") { // subject value is Report Broken Link
	$broken = " selected";
}
if ($subj == "spyware") { // subject value is Report Spyware
	$spyware = " selected";
}
if ($subj == "authors") { // subject value is Program Submission, Listing Issue
	$authors = " selected";
}
if ($subj == "promote") { // subject value is Advertising Inquires
	$promote = " selected";
}
if ($subj == "remove") { // subject value is Listing Removal Request
	$remove = " selected";
}
if ($subj == "scripts") { // subject value is Regarding your PHP Scripts
	$scripts = " selected";
}
else { // subject value is not specified
	$select = " selected";
}

$premsg = "";
if ($progid) {
	$premsg = "User report for ProgID=" . $progid . ":\n\n";
}

// Requesting form data
$name         = $_POST["name"];
$email        = $_POST["email"];
$subject      = $_POST["subject"];
$mtext        = $_POST["mtext"];
$securitycode = $_POST["securitycode"];
$submit       = $_POST["submit"];

if(empty($submit)) {
	echo "<form name=\"contact\" action=\"" . $PHP_SELF . "\" method=\"post\" onsubmit=\"return formcheck()\">\n";
	echo "<table class=\"tvisible\" width=\"440\" cellspacing=\"0\" cellpadding=\"4\">\n";
	echo "<tr>\n";
	echo "<td class=\"tdark\"><label for=\"name\"><p><b>Your Name:</b></p></label></td>\n";
	echo "<td><input type=\"text\" class=\"text\" name=\"name\" size=\"35\" maxlength=\"50\"></td>\n";
	echo "</tr><tr>\n";
	echo "<td class=\"tdark\"><label for=\"email\"><p><b>Your Email Address:</b></p></label></td>\n";
	echo "<td><input type=\"text\" class=\"text\" name=\"email\" size=\"35\" maxlength=\"50\"></td>\n";
	echo "</tr><tr>\n";
	echo "<td class=\"tdark\"><label for=\"subject\"><p><b>Message Subject:</b></p></label></td>\n";
	echo "<td><select name=\"subject\">\n";
	echo "<option value=\"0\"" . $select . ">&lt; Select &gt; &nbsp; &nbsp;</option>\n";
	echo "<option value=\"General Feedback\">General Feedback</option>\n";
	echo "<option value=\"Report Broken Link\"" .  $broken . ">Report Broken Link</option>\n";
	echo "<option value=\"Report Spyware\"" . $spyware . ">Report Spyware</option>\n";
	echo "<option value=\"Program Submissions, Listing Issue\"" . $authors . ">Program Submissions, Listing Issue</option>\n";
	echo "<option value=\"Advertising Inquires\"" . $promote . ">Advertising Inquires</option>\n";
	echo "<option value=\"Listing Removal Request\"" . $remove . ">Listing Removal Request</option>\n";
	echo "<option value=\"Regarding your PHP Scripts\"" . $scripts . ">Regarding your PHP Scripts</option>\n";
	echo "<option value=\"Other\">Other</option>\n";
	echo "</select></td>\n";
	echo "</tr><tr>\n";
	echo "<td class=\"tdark\"><label for=\"mtext\"><p><b>Message Text:</b><br><small>(2000 Chr. Max)</small></p></label></td>\n";
	echo "<td><textarea name=\"mtext\" rows=\"9\" cols=\"32\">" . $premsg . "</textarea></td>\n";
	echo "</tr><tr>\n";
	echo "<td class=\"tdark\"><label for=\"securitycode\"><p><b>Security Code:</b><img src=\"codeimg.php\" width=\"44\" height=\"14\" border=\"0\" alt=\"Security Code\"></p></label></td>\n";
	echo "<td><input type=\"text\" class=\"text\" name=\"securitycode\" id=\"securitycode\" size=\"12\" maxlength=\"4\"></td>\n";
	echo "</tr><tr>\n";
	echo "<td class=\"tdark\"><p><b>Submit:</b></p></td>\n";
	echo "<td><input type=\"submit\" class=\"button\" name=\"submit\" value=\"   Submit   \">&nbsp; &nbsp; &nbsp;<input type=\"reset\" class=\"button\" value=\"   Reset   \"></td>\n";
	echo "</tr>\n</table>\n</form>\n<br>\n";
}
else { // Processing received data
	if(empty($name)) { // If the name field is empty
		$bad  = "You did not enter your name!<br>";
	}
	if(empty($email)) { // If the email address field is empty
		$bad .= "You did not enter your email address!<br>";
	}
	if(!eregi("^([a-z0-9_/.~\-]+)@([a-z0-9_/.~\-]+)\.([a-z]+)$", $email)) { // If the email address does not match the regular expression
		$bad .= "The email address is not valid!<br>";
	}
	if($subject == "0") { // If the message subject is not selected
		$bad .= "You did not select the message subject!<br>";
	}
	if(empty($mtext)) { // If the message text field is empty
		$bad .= "You did not enter a description in message text field!<br>";
	}
	if(empty($securitycode)) { // If the security code field is empty
		$bad .= "You did not enter the security code!<br>";
	}
	if($securitycode != $_SESSION["SecurityCode"]) { // If the security code does not match the generated one
		$bad .= "The security code is wrong!<br>";
	}
	if($bad) { // Displaying warning message and exiting
		echo "<h2 class=\"red\">" . $bad . "</h2>\n";
		echo "<p><b>Please go <a href=\"javascript:history.back()\">Back</a> and fill the form correctly.</b></p>\n";
	}
	else { // Form is OK
		$name  = substr($name,0,50);    // Cutting off too long user name
		$email = substr($email,0,50);   // Cutting off too long user email address
		$mtext = substr($mtext,0,2000); // Cutting off too long message text

		// Generating email message from received data
		$subject  = $sitename . " - " . $subject;
		$message  = $mtext . "\r\n";
		$headers  = "From: " . $name . "<" . $email . ">\r\n";
		$headers .= "Reply-To: " . $name . "<" . $email . ">\r\n";
		$headers .= "Content-Type: text/plain; charset=windows-1252";

		if(mail($sitemail, $subject, $message, $headers)) { // If message was successfully sent:
			echo "<h2 class=\"green\">Your message was sent. Thank You!<br></h2>\n";
		}
		else { // If any unspecified error occures:
			echo "<h2 class=\"red\">Sorry, an error occured while sending your message!<br></h2>\n";
			echo "<p><b>Please go <a href=\"javascript:history.back()\">back</a> and try again later.</b></p>\n";
		}
	}
}
?>
<br>

</td><td class="tbody" width="182">

</td>
</tr>
</table>
</td></tr></table>
<?php include("fooder.inc"); ?>